package lijun.parking.Entity;


import cn.hutool.json.JSONUtil;

import java.sql.Time;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 车辆 实体类
 */
public class Car {
    private String carId;
    private String carNumber;
    /**
     * 车辆类型：中小型、大型、新能源（可根据查车牌类型获得）
     */
    private String carType;
    /**
     * 是否包月
     */
    private boolean baoyue;
    /**
     * 进入时间
     */
    private Date enterTime;
    /**
     * 车辆收费单价
     */
    private double price;
    /**
     * 是否在场
     */
    private boolean isPresent;
    /**
     * 离开时间
     */
    private Date leaveTime;

    public String getCarId() {
        return carId.trim();
    }

    public void setCarId(String carId) {
        this.carId = carId;
    }

    public String getCarNumber() {
        return carNumber.trim();
    }

    public void setCarNumber(String carNumber) {
        this.carNumber = carNumber;
    }

    public String getCarType() {
        return carType.trim();
    }

    public void setCarType(String carType) {
        this.carType = carType;
    }

    public boolean isBaoyue() {
        return baoyue;
    }

    public void setBaoyue(boolean baoyue) {
        this.baoyue = baoyue;
    }

    public Date getEnterTime() {
        return enterTime;
    }

    public void setEnterTime(Date enterTime) {
        this.enterTime = enterTime;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public boolean isPresent() {
        return isPresent;
    }

    public void setPresent(boolean present) {
        isPresent = present;
    }

    public Date getLeaveTime() {
        return leaveTime;
    }

    public void setLeaveTime(Date leaveTime) {
        this.leaveTime = leaveTime;
    }

    public Car() {
    }

    public Car(String carId, String carNumber, String carType, boolean baoyue, Date enterTime, double price, boolean isPresent, Date leaveTime) {
        this.carId = carId;
        this.carNumber = carNumber;
        this.carType = carType;
        this.baoyue = baoyue;
        this.enterTime = enterTime;
        this.price = price;
        this.isPresent = isPresent;
        this.leaveTime = leaveTime;
    }

    @Override
    public String toString() {
        SimpleDateFormat sdf = new SimpleDateFormat();
        sdf.applyPattern("yyy/MM/dd HH:mm:ss");
        return "  " +
                carId +
                "  | '" + carNumber +
                " | '" + carType +
                " | " + (baoyue == true ? "包 月" : "不包月") +
                " | " + sdf.format(enterTime) +
                " | " + price +
                " | " + (isPresent == true ? "在 场" : "不在场") +
                " | " + sdf.format(leaveTime) +
                '}';
    }
}
